package com.levi.juc.function_interface;

import java.util.function.Function;

/**
 * Funtion函数式接口
 * 传入一个参数，返回一个类型的返回值
 */
public class FunctionTest {
    public static void main(String[] args) {
//        Function<String, String> function = new Function<String, String>() {
//            @Override
//            public String apply(String str) {
//                return str;
//            }
//        };
        //使用lambda
        Function<String, String> function = (str) -> str;


        System.out.println(function.apply("stringtest"));

       Function<String,String> function1 = str -> str+"world !!";
        System.out.println(function1.apply("hello "));
    }
}
